//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __SYSTYPE_H__
#define __SYSTYPE_H__

#include <elatypes.h>
#include <car.h>

#if defined(__cplusplus)

_ELASTOS_NAMESPACE_USING

interface IStub : public IInterface {
    virtual CARAPI_(void) Invoke(
#ifdef _win32
            /* [in] */ UInt32 uClientId,
#endif
            /* [in] */ void *pvData,
            /* [in] */ UInt32 uSize) = 0;

    virtual CARAPI GetOid(
            /* [out] */ oid_t *pOid) = 0;

    virtual CARAPI GetClsid(
            /* [out] */ EMuid *pClsid) = 0;

    virtual CARAPI InterfaceIndex(
            /* [in] */ IInterface *pObj,
            /* [out] */ UInt32 *puIndex) = 0;

    virtual CARAPI GetClassEntry(
            /* [out] */ UInt32 *pClassEntry) = 0;

};
#else     /* C style interface */

#ifndef __IStub_FWD_DEFINED__
#define __IStub_FWD_DEFINED__
typedef interface IStub IStub;
#endif     /* __IStub_FWD_DEFINED__ */

    typedef struct IStubVtbl
    {

        PInterface (CARAPICALLTYPE *Probe )(
            IStub * This,
            /* [in] */ REIID riid);

        UInt32 (CARAPICALLTYPE *AddRef )(
            IStub * This);

        UInt32 (CARAPICALLTYPE *Release )(
            IStub * This);

        ECode (CARAPICALLTYPE *Aggregate)(
            IStub *pThis,
            /* [in] */ AggregateType type,
            /* [in] */ PInterface pObj);

        void (CARAPICALLTYPE *invoke )(
            IStub * This,
#ifdef _win32
            /* [in] */ UInt32 uClientId,
#endif
            /* [in] */ void *pvData,
            /* [in] */ UInt32 uSize);

        ECode (CARAPICALLTYPE *GetOid )(
            IStub * This,
            /* [out] */ oid_t *pOid);

        ECode (CARAPICALLTYPE *GetClsid )(
            IStub * This,
            /* [out] */ EMuid *pClsid);

        ECode (CARAPICALLTYPE *InterfaceIndex )(
            IStub * This,
            /* [in] */ IInterface *pObj,
            /* [out] */ UInt32 *puIndex);

        ECode (CARAPICALLTYPE *GetClassEntry )(
            IStub * This,
            /* [out] */ UInt32 *pClassEntry);

    } IStubVtbl;

    interface IStub
    {
        CONST_VTBL struct IStubVtbl *v;
    };

#ifdef COBJMACROS

#define IStub_Probe(This,riid)    \
    (This)->v-> Probe(This,riid)

#define IStub_AddRef(This)    \
    (This)->v->AddRef(This)

#define IStub_Release(This)    \
    (This)->v->Release(This)

#define IStub_invoke(This, pvData, uSize)    \
    (This)->v->invoke(This, pvData, uSize)

#define IStub_GetOid(This, pOid)    \
    (This)->v->GetOid(This, pOid)

#define IStub_GetClsid(This, pClsid)    \
    (This)->v->GetClsid(This, pClsid)

#define IStub_InterfaceIndex(This, pObj, puIndex)    \
    (This)->v->InterfaceIndex(This, pObj, puIndex)

#define IStub_GetClassEntry(This, pClassEntry)    \
    (This)->v->GetClassEntry(This, pClassEntry)

#endif /* COBJMACROS */

#endif     /* C style interface */

#endif //__SYSTYPE_H__
